package com.xiaoy.core.base.security.org.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.xiaoy.core.base.security.user.entity.User;
import com.xiaoy.core.base.util.store.config.ConfigTable;
import com.xiaoy.entity.BaseBean;

@Entity
@Table(name = ConfigTable.Security.ORG_USER_TABLENAME)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class OrgUser extends BaseBean{

	private Org org;
	private User user;
	
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) 
	@JoinColumn(name="org_id")
	public Org getOrg() {
		return org;
	}
	public void setOrg(Org org) {
		this.org = org;
	}
	
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) 
	@JoinColumn(name="user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
}
